package name.fowler.refactoring.simplestore;

public class ReportBuilder {

	public String getReport(Customer customer, DiscountCalculator calc) {
		double totalAmount = 0;
		String result = "Rental record for " + customer.name + "\n";
		for (Rental rental : customer.rentals) {
			calc.updateFrequentRenterPoints(customer, rental);
			result += "\t" + rental.getMovie().getTitle() + "\t" + rental.getRentalAmount() + "\n";
			totalAmount += rental.getRentalAmount();
		}
		result += "Amount owed is " + totalAmount + "\n";
		result += "You earned " + customer.frequentRenterPoints + " frequent renter points.";
		return result;
	}

}
